CodeLensProvider (VS Code API)
#CodeLens #VS_Code_API
https://code.visualstudio.com/api/references/vscode-api#CodeLensProvider<T>
A code lens provider adds commands to source text.
「ソーステキストにコマンドを追加する」
2つのメソッド
独自のCodeLensProviderは2つとも実装する必要がある
provideCodeLenses(document: TextDocument, token: CancellationToken): ProviderResult<T[]>
Compute a list of lenses.
This call should return as fast as possible and if computing the commands is expensive implementors should only return code lens objects with the range set and implement resolve.
「可能な限り速く返すべき」
「コマンドの計算が高コストならば、実装者は範囲(range)の集合と一緒にCodeLensオブジェクト(複数)だけを返し、resolveを実装すべき」
resolveCodeLens(codeLens: T, token: CancellationToken): ProviderResult<T>
This function will be called for each visible code lens, usually when scrolling and after calls to compute-lenses.
「見えている範囲のCodeLensそれぞれについて呼び出される」
「スクロールするときやCodeLensの計算の呼び出しのあとに」